package Library;

import Library.User.AdmiUser;
import Library.User.NormalUser;
import Library.User.User;

import java.util.Scanner;

public class Main {
    public static User Login(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的姓名");
        String name = scanner.next();
        System.out.println("请输入你角色->(1：普通用户, 2：管理员)");
        int role = scanner.nextInt();
        if(role == 1){
            return new NormalUser(name);
        } else if(role == 2){
            return new AdmiUser(name);
        } else {
            System.out.println("输入错误");
            return null;
        }


    }
    public static void main(String[] args) {
        BookList bookList = new BookList();
        User user = Login();
        while (true){
            int choice = user.menu();
            user.work(choice,bookList);
        }

    }
}
